﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Globalization;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace KgUtils.Validation
{
    public static partial class InputValidationHelper
    {
        public static bool IsInt(string val)
        {
            int intVal;
            return int.TryParse(val, out intVal);
        }

        public static bool IsDate(string val, string format)
        {
            DateTime dateVal;
            return DateTime.TryParseExact(val, format, Thread.CurrentThread.CurrentUICulture.DateTimeFormat, DateTimeStyles.None, out dateVal)
                && dateVal.CompareTo(Constants.SqlServerDateRangeMin) > 0
                && dateVal.CompareTo(Constants.SqlServerDateRangeMax) < 0;
        }
    }
}
